package com.repair.order.validator;

import com.repair.api.category.service.CategoryFacadeService;
import com.repair.order.exception.OrderException;
import com.repair.order.pojo.dto.OrderCreateParam;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Component;

/**
 * @author chunyu
 * @since 2024/10/2,15:39
 */
@Component
public class ServiceTypeValidate extends BaseOrderCreateValidate {

    @DubboReference
    private CategoryFacadeService categoryFacadeService;

    @Override
    protected void doValidate(OrderCreateParam orderCreateParam) throws OrderException {
        // TODO 判断服务类型id 有没有对应服务
        // 查
//        ServiceQeuryByIdRequest request = new ServiceQeuryByIdRequest();
//        request.setId(orderCreateParam.getServiceCategoryId());
//        ServiceQueryIdResponse response = categoryFacadeService.getServiceIdById(request);
//        Long serviceId = response.getServiceId();
//        // 判断
//        if (serviceId == null) {
//            // null 抛异常
//            throw new OrderException("服务类型不存在", OrderErrorCode.SERVICE_TYPE_NOT_EXIST);
//        }
//        // 有 继续调用下一个校验器


    }
}
